/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vn.com.pps.web.common.component.table;

/**
 *
 * @author DaiMX
 */
public class NumberColumnComparator extends AbstractColumnComparator
{
  protected NumberColumnComparator(String pm_attributeName, boolean pm_isAscending)
  {
    super(pm_attributeName, pm_isAscending);
  }

  public int compareValue(Object pm_valueSource, Object pm_valueTarget)
  {
    Number valueSource = (pm_valueSource != null) ? new Integer((String)pm_valueSource) : new Integer(0);
    Number valueTarget = (pm_valueTarget != null) ? new Integer((String)pm_valueTarget) : new Integer(0);

    return (this.m_isAscending) ? valueSource.intValue() - valueTarget.intValue() : valueTarget.intValue() - valueSource.intValue();
  }
}